import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            redirect: '/zhiyouyun/index'
        },
        //首页
        {
            path: '/zhiyouyun/index',
            name: 'index',
            component: () => import('@/views/index/index.vue')
        },
        //关于致优
        {
            path: '/zhiyouyun/aboutMe',
            name: 'aboutMe',
            component: () => import('@/views/aboutMe/aboutMe.vue')
        },
        //产品服务-确权布局
        {
            path: '/zhiyouyun/produceService/ownership',
            name: 'ownership',
            component: () => import('@/views/ownershipService/ownershipService.vue')
        },
        //知产保护
        {
            path:'/zhiyouyun/produceService/intellectualPropertyProtection',
            name:'intellectualPropertyProtection',
            component: () => import('@/views/intellectualPropertyProtection/intellectualPropertyProtection.vue')
        },
        //授权管理
        {
            path:'/zhiyouyun/produceService/authorizeManage',
            name:'authorizeManage',
            component: () => import('@/views/authorizeManage/authorizeManage.vue')
        },
        //知优数字精灵
        {
            path:'/zhiyouyun/produceService/zyszjl',
            name:'zyszjl',
            component: () => import('@/views/zyszjl/zyszjl.vue')
        },
        //渠道管控
        {
            path:'/zhiyouyun/produceService/channelControl',
            name:'channelControl',
            component: () => import('@/views/channelControl/channelControl.vue')
        },
        //致优专栏
        {
            path:'/zhiyouyun/zhiyouColumn',
            name:'zhiyouColumn',

            component: () => import('@/views/zhiyouColumn/zhiyouColumn.vue')
        },
        //致优专栏详情
        {
            path:'/zhiyouyun/columnDetail',
            name:'columnDetail',
            meta:{ noSaveScroll: true },
            component: () => import('@/views/columnDetail/columnDetail.vue')
        },
        //联系我们
        {
            path:'/zhiyouyun/contactUs',
            name:'contactUs',
            component: () => import('@/views/contactUs/contactUs.vue')
        },


    ],
    scrollBehavior(to, from, savedPosition) {
        // // 如果目标路由有meta.noSaveScroll标记，则滚动到顶部
        // if (!to.meta.noSaveScroll) {
        //     return { top: 0 }
        // }
        // // 否则使用保存的位置或滚动到顶部
        // return savedPosition || { top: 0 }
        return { top: 0 }
    }
})

export default router